package com.vchello.util;

import java.util.Random;

/**
 * @author power
 * @time 2015年11月12日下午2:41:24
 */
public class RandomUtil {
    
    public static int randomNum(){
    	return (int)((Math.random()*9+1)*100000);
    }
    
    public static String randomCode(){
    	String sRand = "";
		int itmp = 0;
		Random random = new Random();
		for (int i = 0; i < 8; i++) {
			if (random.nextInt(2) == 1) {
				itmp = random.nextInt(26) + 65; // 生成A~Z的字母
			} else {
				itmp = random.nextInt(10) + 48; // 生成0~9的数字
			}
			char ctmp = (char) itmp;
			sRand += String.valueOf(ctmp);

		}
		return sRand;
    	
    }
}
